import React from 'react';
import { Row, Col, Spin } from 'antd';
import { connect } from 'dva';
//左侧
import CalendarTodoList from './component/calendarTodoList';
import CurrentMeeting from './component/currentMeeting';
//中间
import InfoWran from './component/InfoWarn';
import CommonFun from './component/commonFun';
import NegativeNews from './component/NegativeNews';
import CompanyNotice from './component/companyNotice';
//右侧
import MessageRemind from './component/messageRemind';

import boardStyle from './index.less';
class OperatePlatform extends React.Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  componentDidMount() {
    const { dispatch } = this.props;
    this.mounted = true;
  }
  componentWillUnmount() {
    this.mounted = false;
  }
  render() {
    const { isLoading } = this.props;
    return (
      <div>
        <div className={boardStyle.wrapperContent} style={{ top: '0px', padding: '10px 0px' }}>
          <Row style={{ width: '100%', marginLeft: '0px', marginRight: '0px' }} type='flex' justify='space-between' gutter={16}>
            <Col span={7}>
              <div className={boardStyle.leftWrap}>
                <CalendarTodoList />
                <CurrentMeeting />
              </div>
            </Col>
            <Col className={boardStyle.middleWrap} span={11}>
              <div className={boardStyle.middleTop}>
                {isLoading ? (
                  <div className={boardStyle.infobcg}>
                    <Spin spinning={true}></Spin>
                  </div>
                ) : this.mounted ? (
                  <InfoWran />
                ) : (
                  <div className={boardStyle.infobcg}>
                    <Spin spinning={true}></Spin>
                  </div>
                )}
              </div>
              <div className={boardStyle.middleCenter}>
                <CommonFun />
              </div>
              <div className={boardStyle.middleBottom}>
                <NegativeNews />
                <CompanyNotice />
              </div>
            </Col>
            <Col className={boardStyle.rightWrap} span={6}>
              <MessageRemind />
            </Col>
          </Row>
        </div>
      </div>
    );
  }
}
export default connect(({ userM: user, OperatePlatformM, loading, tenantM }) => ({
  user,
  OperatePlatformM,
  //用于判断isLoading，需要根据工作台根据左侧菜单添加修改权限，
  isLoading: loading.effects['userM/getMenu'],
  XQLoad: loading.effects['OperatePlatformM/storeSuper'],
  tenantM,
}))(OperatePlatform);
